import Vue from 'vue'
import AppLayout from './components/AppLayout.vue'
import router from './router/router'
import "./golbal-components"
import VueFetch,{$fetch} from "./plugins/fetch"
import state from './state'
import VueState from './plugins/state'
import * as filters from './filters'


Vue.config.productionTip = false
Vue.use(VueFetch,{baseUrl:'http://localhost:3000/'})
Vue.use(VueState,state)
for (const key in filters) {
  Vue.filter(key,filters[key])
}

async function main(){
  try {
    state.user= await $fetch('user')
  } catch (e) {
    console.warn(e)
  }
}

const myVm=new Vue({
  router,
  data:state,
  render: h => h(AppLayout)
}).$mount('#app')

main()



